fix(runner): Stream End fixes - #1920
Open
Mazi02 wants to merge 3 commits into
Open
Conversation
Writes the .del- marker livestreamCleanup looks for. So far that marker was only written by CheckVoD, which the discard path skips. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The skip detected StreamEnd by comparing function pointers and depended on the loop position, so reordering the action list broke it silently. RunAction now takes the VoD and discard actions as their own lists. It also depended on AbortingError not skipping the following actions, contrary to the doc comment on Action - describe the actual behaviour instead, ending a stream early needs StreamEnd to run after the cancelled Stream action. RequestStreamEnd returns an actual response now, (nil, nil) is an internal error. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The runner only tracks jobs of its current process while the job rows live in the db, so NotFound is the normal case after a regular run, a double click on "end stream" or a runner restart - and turned every such click into a HTTP 500. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Follow-up to the end-stream feature. The runner could be killed by a data race, ending an
already ended stream returned a 500, the discard logic depended on behaviour that contradicts
its own documentation, and discarded recordings were never deleted from disk.
Description
jobsanddiscardwere used from the gRPC handlers, the job goroutines and the heartbeatwithout synchronization. Go aborts the whole process for this, taking every running job with
it. Both are now behind a
RWMutex, accessed viajobCount/discarded/endJob.endRunnerJobtreatscodes.NotFoundas success. The runner only knows the jobs of itscurrent process while the job rows live in the db, so an unknown job is already in the
desired state (finished regularly, double click, runner restarted).
RunActionas their own list and skipped explicitly, insteadof detecting
StreamEndby comparing function pointers. TheActiondoc comment nowdescribes what actually happens: an
AbortingErrorstops the retries, not the followingactions — ending a stream early depends on that.
DiscardRecordingaction writes the.del-marker thatlivestreamCleanuplooks for.It was previously written by
CheckVoDonly, which discard skips, so discarded recordingsstayed on disk forever.
RequestStreamEndreturns an actual response message;(nil, nil)is an internal error in gRPC.Steps for Testing
Prerequisites:
/api/stream/<streamID>/end→ the stream stops being live in the UI./api/stream/<streamID>/end?discard=true→ the runnerlogs
discarding recording, skipping VoD creation, no VoD is created, and the recordingdirectory under
SEGMENT_PATHis deleted within a minute.